package com.example.event_resource_java.oss.controller;

import com.example.event_resource_java.commons.util.ApiResult;
import com.example.event_resource_java.oss.server.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 *  阿里云OSS上传接口
 *  @Author: xzy
 * @Date: 2024/4/18 10:44
 */
@RestController
@RequestMapping("/jzEve/Oss")
public class OssController {

    @Autowired
    OssService ossService;


    /**
     * 文件上传接口
     */
    @PostMapping("/fileImprot")
    public ApiResult<?> fileImprot(@RequestParam("file") MultipartFile file) {
        String url = "";
        url = ossService.uploadFileOss(file);
        System.out.println("分片上传视频地址++++++++++++++++++++++++++++++++++++++++++"+url);
        return ApiResult.success("上传成功", url);
    }



}
